public class People {
    public String name;
    public int hp;

    //持有枪的引用
    public Gun gun;

    public People() {
    }

    public People(String name) {
        this.name = name;
        this.hp = 100;
    }

    public People(String name, Gun gun) {
        this.name = name;
        this.gun = gun;
        this.hp = 100;
    }

    // 开枪
    public void biuBiu(People laoBa) {
        gun.openFire(laoBa);
    }

    // 掉血
    public void downHp(int atk) {
        if (hp > 0) {
            hp -= atk;
            if (hp < 0) {
                hp = 0;
                System.out.println("人已经阵亡");
            }else if(hp == 0){
                System.out.println("人已经阵亡");
            }else{
                System.out.println(name + "此人已中枪，还剩" + hp + "点血");
            }

        } else {
            hp = 0;
            System.out.println("人已经阵亡，无需鞭尸");
        }

    }
}
